﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using gnu.trove.set.hash;

namespace Game.templates.npc
{
    public class AbsorbInfo
    {
        public enum AbsorbType
        {
            /**
             * Field LAST_HIT.
             */
            LAST_HIT,
            /**
             * Field PARTY_ONE.
             */
            PARTY_ONE,
            /**
             * Field PARTY_ALL.
             */
            PARTY_ALL,
            /**
             * Field PARTY_RANDOM.
             */
            PARTY_RANDOM
        }
        private bool _skill;
	    /**
	     * Field _absorbType.
	     */
	    private AbsorbType _absorbType;
	    /**
	     * Field _chance.
	     */
	    private int _chance;
	    /**
	     * Field _cursedChance.
	     */
	    private int _cursedChance;
	    /**
	     * Field _levels.
	     */
	    private TIntHashSet _levels;
        public AbsorbInfo(bool skill, AbsorbType absorbType, int chance, int cursedChance, int min, int max)
        {
            _skill = skill;
            _absorbType = absorbType;
            _chance = chance;
            _cursedChance = cursedChance;
            _levels = new TIntHashSet(max - min);
            for (int i = min; i <= max; i++)
            {
                _levels.add(i);
            }
        }
        public bool isSkill()
        {
            return _skill;
        }
        public AbsorbType getAbsorbType()
        {
            return _absorbType;
        }
        public int getChance()
        {
            return _chance;
        }
        public int getCursedChance()
        {
            return _cursedChance;
        }
        public bool canAbsorb(int le)
        {
            return _levels.contains(le);
        }
    }
}
